Skip to content

Extract rule: template-no-args-paths#2455

Merged
NullVoxPopuli merged 2 commits intoember-cli:masterfrom
NullVoxPopuli:nvp/template-lint-extract-rule-template-no-args-paths
Mar 13, 2026
Merged

Extract rule: template-no-args-paths#2455
NullVoxPopuli merged 2 commits intoember-cli:masterfrom
NullVoxPopuli:nvp/template-lint-extract-rule-template-no-args-paths

Conversation

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Split from #2371.

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/template-lint-extract-rule-template-no-args-paths branch 2 times, most recently from 6ca1678 to 444cbcb Compare March 10, 2026 22:24
@johanrd
Copy link
Copy Markdown
Contributor

johanrd commented Mar 12, 2026

Review from claude: comparing against ember-template-lint no-args-paths

Missing isLocal check — false positives on block params. The original calls isLocal(node) to skip paths where args is a block param, not the component's args hash:

{{#each items as |args|}}                                                                                                                                                                                          
  {{args.name}}  {{!-- original: OK (block param). PR: flagged --}}
{{/each}}                                                                                                                                                                                                          

This is relevant in gjs/gts too. Would need manual block-param scope tracking to fix.

@args.foo should not be flagged. The original checks node.data (true when path starts with @) and skips it — @args is a legitimate named argument. The PR flags @args.foo via startsWith('@args.').
Remove that check:

// remove this line:                                                                                                                                                                                               
path?.startsWith('@args.') ||

Error message loses the specific replacement. Original: Component templates should avoid "args.foo" usage, try "@foo" instead. — computes the replacement by slicing off args. and prepending @. PR gives
generic guidance. The specific message is more actionable:

messages: {     
  argsPath: 'Component templates should avoid "{{path}}" usage, try "@{{replacement}}" instead.',
},                                                                                               
// ...                                                                                                                                                                                                             
data: {
  path: node.original,                                                                                                                                                                                             
  replacement: node.original.replace(/^(this\.)?args\./, ''),
},                                                                                                                                                                                                                 

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/template-lint-extract-rule-template-no-args-paths branch from 444cbcb to 77fbe79 Compare March 13, 2026 17:46
@NullVoxPopuli NullVoxPopuli merged commit 589f47e into ember-cli:master Mar 13, 2026
9 checks passed
@NullVoxPopuli NullVoxPopuli deleted the nvp/template-lint-extract-rule-template-no-args-paths branch March 13, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants